<template>
  <div class="mv-container">
    <my-scroll>
      <div class="mv-wrap">
        <!-- mv -->
        <div class="video-wrap">
          <video controls autoplay :src="mvUrl"></video>
        </div>
        <!-- mv信息 -->
        <div class="info-wrap">
          <div class="singer-info">
            <div class="avatar-wrap">
              <img :src="songer.picUrl" alt />
            </div>
            <span class="name">{{ mvInfo.artistName }}</span>

            <span class="date">发布：{{ mvInfo.publishTime }}</span>
            <span class="number">播放：{{ mvInfo.playCount }}次</span>
          </div>
          <div class="mv-info">
            <h2 class="title">{{ mvInfo.name }}</h2>
            <div class="desc">{{ mvInfo.desc }}</div>
          </div>
        </div>
        <!-- <div class="other">
          <h3>相关推荐</h3>
          <div class="items">
            <div class="item" @click="toMv(item.id)" v-for="(item,index) in 10" :key="index">
              <div class="img-wrap">
                <img :src="item.cover" alt />
                <div class="num-wrap">
                  <div class="iconfont icon-play"></div>
                  <div class="num">{{item.playCount}}</div>
                </div>
                <div class="iconbox">
                  <span class="iconfont icon-play"></span>
                </div>
              </div>
              <div class="info-wrap">
                <div class="name">{{item.name}}</div>
                <div class="singer">{{item.artistName}}</div>
              </div>
            </div>
          </div>
        </div>-->
      </div>
    </my-scroll>
  </div>
</template>

<script>
import { GetSingleMv, GetMvDetail, MvAuthor } from "../../api/music"
export default {
  name: "mv",
  data() {
    return {
      // 总条数
      total: 20,
      // 页码
      page: 1,
      // 页容量
      limit: 10,
      mvUrl: "",
      mvInfo: {},
      songer: {},
    }
  },
  watch: {
    // $route: function(newVal, oldVal) {
    //   if (this.$route.query.id) {
    //     this.getMv();
    //   }
    // }
  },
  created() {
    this.getMv()
    this.getInfo()
    // this.getOther();
  },
  methods: {
    handleCurrentChange(val) {
      // console.log(`当前页: ${val}`)
    },
    async getMv() {
      // axios({
      //   url: "https://autumnfish.cn/mv/url",
      //   method: "get",
      //   params: {
      //     id: this.$route.query.id,
      //   },
      // }).then((res) => {
      //   this.mvUrl = res.data.data.url
      // })
      const res = await GetSingleMv({
        id: this.$route.query.id,
      })
      this.mvUrl = res.data.url
    },
    async getInfo() {
      const res = await GetMvDetail({
        mvid: this.$route.query.id,
      })
      this.mvInfo = res.data
      this.getSonger()
    },
    async getSonger() {
      const res = await MvAuthor({
        id: this.mvInfo.artistId,
      })
      this.songer = res.artist
    },
    // getOther() {
    //   axios({
    //     url: "https://autumnfish.cn/simi/mv",
    //     method: "type",
    //     params: {
    //       mvid: this.$route.query.id
    //     }
    //   }).then(res => {
    //     console.log(res);
    //   });
    // }
  },
}
</script>
<style lang="scss" scoped>
@media (max-width: 600px) {
  .mv-container {
    width: 100%;
    height: 100%;
  }

  .mv-container .mv-wrap {
    width: calc(100% - 40px);
    margin: 1.25rem 0.625rem;
  }

  .mv-container .mv-wrap .date {
    margin-right: 0.625rem;
  }

  .mv-container .mv-wrap .date,
  .mv-container .mv-wrap .number {
    color: #bebebe;
    font-size: 14px;
  }
  .number {
    margin-left: 4.6rem;
  }

  .mv-container .mv-wrap .video-wrap {
    width: 100%;
    height: 12.5rem;
    margin-bottom: 20px;
  }

  .mv-container .mv-wrap .video-wrap video {
    border-radius: 5px;
    height: 100%;
    width: 100%;
    outline: none;
  }

  .mv-container .mv-wrap .info-wrap {
    margin: 0px 10px;
  }

  .mv-container .mv-wrap .info-wrap .singer-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }
  .date {
    margin-left: 30px;
  }
  .mv-container .mv-wrap .info-wrap .singer-info .avatar-wrap {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    margin-right: 10px;
    overflow: hidden;
  }

  .mv-container .mv-wrap .info-wrap .singer-info .avatar-wrap img {
    width: 4rem;
    height: 4rem;
  }

  .title {
    font-size: 1.25rem;
    display: inline-block;
  }

  .mv-container .mv-wrap .info-wrap .mv-info .desc {
    line-height: 25px;
    font-size: 15px;
    margin-top: 20px;
  }
  .other {
    margin: 10px 20px;
    .items {
      display: flex;
      justify-content: flex-start;
      flex-wrap: wrap;
    }

    .items .item {
      width: 250px;
      cursor: pointer;
      margin-right: 20px;
      margin-bottom: 30px;
    }

    .items .item .img-wrap {
      width: 100%;
      position: relative;
      .iconbox {
        position: absolute;
        top: 0px;
        left: 0px;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.6);
        color: #dd6d60;
        display: flex;
        justify-content: center;
        align-items: center;
        opacity: 0;
        transition: 0.5s;
        span {
          color: #dd6d60;
          width: 35px;
          height: 35px;
          background: rgba(255, 255, 255, 0.7);
          display: flex;
          justify-content: center;
          align-items: center;
          border-radius: 50%;
        }
        span:hover {
          cursor: pointer;
        }
        span:before {
          transform: translateX(1px);
        }
      }
    }
    .items .item .img-wrap:hover .iconbox {
      opacity: 1;
    }
    .items .item .img-wrap img {
      width: 100%;
      border-radius: 5px;
    }

    .items .item .img-wrap .num-wrap {
      position: absolute;
      color: white;
      top: 0;
      right: 0;
      display: flex;
      align-content: center;
      font-size: 15px;
      padding-right: 5px;
      padding-top: 2px;
    }

    .items .item .img-wrap .num-wrap .icon-play {
      font-size: 12px;
      display: flex;
      align-items: center;
      margin-right: 5px;
    }
    .items .item .img-wrap .num-wrap .icon-play {
      font-size: 12px;
      display: flex;
      align-items: center;
      margin-right: 5px;
    }

    .items .item .info-wrap .name {
      font-size: 15px;
      height: 25px;
      line-height: 25px;
      font-size: 15px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .items .item .info-wrap .singer {
      font-size: 14px;
      height: 20px;
      line-height: 20px;
      color: #c5c5c5;
    }
  }
}
@media (min-width: 600px) {
  .mv-container {
    width: 100%;
    height: 100%;
  }

  .mv-container .mv-wrap {
    width: calc(100% - 40px);
    margin: 20px;
    margin-right: 35px;
  }

  .mv-container .mv-wrap .date {
    margin-right: 0.625rem;
  }

  .mv-container .mv-wrap .date,
  .mv-container .mv-wrap .number {
    color: #bebebe;
    font-size: 14px;
  }

  .mv-container .mv-wrap .video-wrap {
    width: 100%;
    height: 460px;
    margin-bottom: 20px;
  }

  .mv-container .mv-wrap .video-wrap video {
    border-radius: 5px;
    height: 100%;
    width: 100%;
    outline: none;
  }

  .mv-container .mv-wrap .info-wrap {
    margin: 0px 20px;
  }

  .mv-container .mv-wrap .info-wrap .singer-info {
    display: flex;
    align-items: center;
  }
  .date {
    margin-left: 0.625rem;
  }
  .mv-container .mv-wrap .info-wrap .singer-info .avatar-wrap {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    margin-right: 10px;
    overflow: hidden;
  }

  .mv-container .mv-wrap .info-wrap .singer-info .avatar-wrap img {
    height: 100%;
  }

  .title {
    font-size: 30px;
    line-height: 40px;
    display: inline-block;
  }

  .mv-container .mv-wrap .info-wrap .mv-info .desc {
    line-height: 25px;
    font-size: 15px;
    margin-top: 20px;
  }
  .other {
    margin: 10px 20px;
    .items {
      display: flex;
      justify-content: flex-start;
      flex-wrap: wrap;
    }

    .items .item {
      width: 250px;
      cursor: pointer;
      margin-right: 20px;
      margin-bottom: 30px;
    }

    .items .item .img-wrap {
      width: 100%;
      position: relative;
      .iconbox {
        position: absolute;
        top: 0px;
        left: 0px;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.6);
        color: #dd6d60;
        display: flex;
        justify-content: center;
        align-items: center;
        opacity: 0;
        transition: 0.5s;
        span {
          color: #dd6d60;
          width: 35px;
          height: 35px;
          background: rgba(255, 255, 255, 0.7);
          display: flex;
          justify-content: center;
          align-items: center;
          border-radius: 50%;
        }
        span:hover {
          cursor: pointer;
        }
        span:before {
          transform: translateX(1px);
        }
      }
    }
    .items .item .img-wrap:hover .iconbox {
      opacity: 1;
    }
    .items .item .img-wrap img {
      width: 100%;
      border-radius: 5px;
    }

    .items .item .img-wrap .num-wrap {
      position: absolute;
      color: white;
      top: 0;
      right: 0;
      display: flex;
      align-content: center;
      font-size: 15px;
      padding-right: 5px;
      padding-top: 2px;
    }

    .items .item .img-wrap .num-wrap .icon-play {
      font-size: 12px;
      display: flex;
      align-items: center;
      margin-right: 5px;
    }
    .items .item .img-wrap .num-wrap .icon-play {
      font-size: 12px;
      display: flex;
      align-items: center;
      margin-right: 5px;
    }

    .items .item .info-wrap .name {
      font-size: 15px;
      height: 25px;
      line-height: 25px;
      font-size: 15px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .items .item .info-wrap .singer {
      font-size: 14px;
      height: 20px;
      line-height: 20px;
      color: #c5c5c5;
    }
  }
}
</style>
